import Vue from 'vue';
import VueRouter from './ylvue-router';

// 执行了 install 方法
Vue.use(VueRouter);

const routes = [
  { path: '/', name: 'Home', component: () => import('../views/Home.vue') },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue'),
    children: [
      {
        path: '/about/info',
        component: {
          render(h) {
            return h('div', 'about info page');
          },
        },
      },
    ],
  },
];

// 创建了 实例 main.js调用
const router = new VueRouter({
  routes,
});

export default router;
